package com.deer.wms.base.system.web;

import com.deer.wms.base.system.model.ErpBackRecord;
import com.deer.wms.base.system.model.ErpRecordCriteria;
import com.deer.wms.base.system.service.ErpService;
import com.deer.wms.project.root.core.result.Result;
import com.deer.wms.project.root.core.result.ResultGenerator;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/erpBack")
public class ErpBackRecodeController {

    @Autowired
    private ErpService erpBackRecordService;

    @ApiOperation(value = "查询erp回传记录", notes = "查询erp回传记录")
    @PostMapping("/selectList")
    public Result selectList(@RequestBody ErpRecordCriteria criteria) {
        PageHelper.startPage(criteria.getPageNum(), criteria.getPageSize());
        List<ErpBackRecord> billList = erpBackRecordService.findList(criteria);
        PageInfo pageInfo = new PageInfo(billList);
        return ResultGenerator.genSuccessResult(pageInfo);
    }

    @ApiOperation(value = "删除erp回传记录", notes = "删除erp回传记录")
    @GetMapping("/deletedErpLog")
    public Result deletedErpLog(Integer id) {
//        erpBackRecordService.deleteById(id);
        return ResultGenerator.genSuccessResult();
    }

    //报错（作废）
    @ApiOperation(value = "批量删除erp回传记录", notes = "批量删除erp回传记录")
    @GetMapping("/deletedErpLogByIds")
    public Result deletedErpLogByList(String ids) {
//        erpBackRecordService.deleteByIds(ids);
        return ResultGenerator.genSuccessResult();
    }

}
